package com.nulldev.util.concurrency.threadIt.v4.executors.fje.interfaces;

import java.util.List;

import com.nulldev.util.internal.backport.concurrency9.Lists;

public interface ThreadPicker<T extends Thread> {
	public T nextThread();

	public default List<T> nextThreads(final int size) {
		if (size <= 1)
			return Lists.of(nextThread());
		@SuppressWarnings("unchecked")
		final T[] o = (T[]) new Thread[size];
		for (int i = 0; i < size; i++) {
			final int _i = i;
			o[_i] = nextThread();
		}
		return Lists.of(o);
	}
}